3.1.41 \(\int \cos ^2(c+d x) (a+i a \tan (c+d x))^3 \, dx\) [41]

Optimal. Leaf size=49 \[ -a^3 x+\frac {i a^3 \log (\cos (c+d x))}{d}-\frac {2 i a^4}{d (a-i a \tan (c+d x))} \]

[Out]

-a^3*x+I*a^3*ln(cos(d*x+c))/d-2*I*a^4/d/(a-I*a*tan(d*x+c))

________________________________________________________________________________________

Rubi [A]
time = 0.04, antiderivative size = 49, normalized size of antiderivative = 1.00, number of steps used = 3, number of rules used = 2, integrand size = 24, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.083, Rules used = {3568, 45} \begin {gather*} -\frac {2 i a^4}{d (a-i a \tan (c+d x))}+\frac {i a^3 \log (\cos (c+d x))}{d}-a^3 x \end {gather*}

Antiderivative was successfully verified.

[In]

Int[Cos[c + d*x]^2*(a + I*a*Tan[c + d*x])^3,x]

[Out]

-(a^3*x) + (I*a^3*Log[Cos[c + d*x]])/d - ((2*I)*a^4)/(d*(a - I*a*Tan[c + d*x]))

Rule 45

Int[((a_.) + (b_.)*(x_))^(m_.)*((c_.) + (d_.)*(x_))^(n_.), x_Symbol] :> Int[ExpandIntegrand[(a + b*x)^m*(c + d
*x)^n, x], x] /; FreeQ[{a, b, c, d, n}, x] && NeQ[b*c - a*d, 0] && IGtQ[m, 0] && ( !IntegerQ[n] || (EqQ[c, 0]
&& LeQ[7*m + 4*n + 4, 0]) || LtQ[9*m + 5*(n + 1), 0] || GtQ[m + n + 2, 0])

Rule 3568

Int[sec[(e_.) + (f_.)*(x_)]^(m_)*((a_) + (b_.)*tan[(e_.) + (f_.)*(x_)])^(n_), x_Symbol] :> Dist[1/(a^(m - 2)*b
*f), Subst[Int[(a - x)^(m/2 - 1)*(a + x)^(n + m/2 - 1), x], x, b*Tan[e + f*x]], x] /; FreeQ[{a, b, e, f, n}, x
] && EqQ[a^2 + b^2, 0] && IntegerQ[m/2]

Rubi steps

\begin {align*} \int \cos ^2(c+d x) (a+i a \tan (c+d x))^3 \, dx &=-\frac {\left (i a^3\right ) \text {Subst}\left (\int \frac {a+x}{(a-x)^2} \, dx,x,i a \tan (c+d x)\right )}{d}\\ &=-\frac {\left (i a^3\right ) \text {Subst}\left (\int \left (\frac {2 a}{(a-x)^2}+\frac {1}{-a+x}\right ) \, dx,x,i a \tan (c+d x)\right )}{d}\\ &=-a^3 x+\frac {i a^3 \log (\cos (c+d x))}{d}-\frac {2 i a^4}{d (a-i a \tan (c+d x))}\\ \end {align*}

________________________________________________________________________________________

Mathematica [B] Both result and optimal contain complex but leaf count is larger than twice the leaf count of optimal. \(99\) vs. \(2(49)=98\).
time = 0.28, size = 99, normalized size = 2.02 \begin {gather*} -\frac {a^3 \left (\cos (c+d x) \left (2 i+2 d x-i \log \left (\cos ^2(c+d x)\right )\right )+\left (-2-2 i d x-\log \left (\cos ^2(c+d x)\right )\right ) \sin (c+d x)\right ) (\cos (c+4 d x)+i \sin (c+4 d x))}{2 d (\cos (d x)+i \sin (d x))^3} \end {gather*}

Antiderivative was successfully verified.

[In]

Integrate[Cos[c + d*x]^2*(a + I*a*Tan[c + d*x])^3,x]

[Out]

-1/2*(a^3*(Cos[c + d*x]*(2*I + 2*d*x - I*Log[Cos[c + d*x]^2]) + (-2 - (2*I)*d*x - Log[Cos[c + d*x]^2])*Sin[c +
 d*x])*(Cos[c + 4*d*x] + I*Sin[c + 4*d*x]))/(d*(Cos[d*x] + I*Sin[d*x])^3)

________________________________________________________________________________________

Maple [B] Both result and optimal contain complex but leaf count of result is larger than twice the leaf count of optimal. 98 vs. \(2 (46 ) = 92\).
time = 0.21, size = 99, normalized size = 2.02

method result size
risch \(-\frac {i a^{3} {\mathrm e}^{2 i \left (d x +c \right )}}{d}+\frac {2 a^{3} c}{d}+\frac {i a^{3} \ln \left ({\mathrm e}^{2 i \left (d x +c \right )}+1\right )}{d}\) \(50\)
derivativedivides \(\frac {-i a^{3} \left (-\frac {\left (\sin ^{2}\left (d x +c \right )\right )}{2}-\ln \left (\cos \left (d x +c \right )\right )\right )-3 a^{3} \left (-\frac {\sin \left (d x +c \right ) \cos \left (d x +c \right )}{2}+\frac {d x}{2}+\frac {c}{2}\right )-\frac {3 i a^{3} \left (\cos ^{2}\left (d x +c \right )\right )}{2}+a^{3} \left (\frac {\sin \left (d x +c \right ) \cos \left (d x +c \right )}{2}+\frac {d x}{2}+\frac {c}{2}\right )}{d}\) \(99\)
default \(\frac {-i a^{3} \left (-\frac {\left (\sin ^{2}\left (d x +c \right )\right )}{2}-\ln \left (\cos \left (d x +c \right )\right )\right )-3 a^{3} \left (-\frac {\sin \left (d x +c \right ) \cos \left (d x +c \right )}{2}+\frac {d x}{2}+\frac {c}{2}\right )-\frac {3 i a^{3} \left (\cos ^{2}\left (d x +c \right )\right )}{2}+a^{3} \left (\frac {\sin \left (d x +c \right ) \cos \left (d x +c \right )}{2}+\frac {d x}{2}+\frac {c}{2}\right )}{d}\) \(99\)

Verification of antiderivative is not currently implemented for this CAS.

[In]

int(cos(d*x+c)^2*(a+I*a*tan(d*x+c))^3,x,method=_RETURNVERBOSE)

[Out]

1/d*(-I*a^3*(-1/2*sin(d*x+c)^2-ln(cos(d*x+c)))-3*a^3*(-1/2*sin(d*x+c)*cos(d*x+c)+1/2*d*x+1/2*c)-3/2*I*a^3*cos(
d*x+c)^2+a^3*(1/2*sin(d*x+c)*cos(d*x+c)+1/2*d*x+1/2*c))

________________________________________________________________________________________

Maxima [A]
time = 0.49, size = 62, normalized size = 1.27 \begin {gather*} -\frac {2 \, {\left (d x + c\right )} a^{3} + i \, a^{3} \log \left (\tan \left (d x + c\right )^{2} + 1\right ) - \frac {4 \, {\left (a^{3} \tan \left (d x + c\right ) - i \, a^{3}\right )}}{\tan \left (d x + c\right )^{2} + 1}}{2 \, d} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(cos(d*x+c)^2*(a+I*a*tan(d*x+c))^3,x, algorithm="maxima")

[Out]

-1/2*(2*(d*x + c)*a^3 + I*a^3*log(tan(d*x + c)^2 + 1) - 4*(a^3*tan(d*x + c) - I*a^3)/(tan(d*x + c)^2 + 1))/d

________________________________________________________________________________________

Fricas [A]
time = 0.35, size = 36, normalized size = 0.73 \begin {gather*} \frac {-i \, a^{3} e^{\left (2 i \, d x + 2 i \, c\right )} + i \, a^{3} \log \left (e^{\left (2 i \, d x + 2 i \, c\right )} + 1\right )}{d} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(cos(d*x+c)^2*(a+I*a*tan(d*x+c))^3,x, algorithm="fricas")

[Out]

(-I*a^3*e^(2*I*d*x + 2*I*c) + I*a^3*log(e^(2*I*d*x + 2*I*c) + 1))/d

________________________________________________________________________________________

Sympy [A]
time = 0.20, size = 61, normalized size = 1.24 \begin {gather*} \frac {i a^{3} \log {\left (e^{2 i d x} + e^{- 2 i c} \right )}}{d} + \begin {cases} - \frac {i a^{3} e^{2 i c} e^{2 i d x}}{d} & \text {for}\: d \neq 0 \\2 a^{3} x e^{2 i c} & \text {otherwise} \end {cases} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(cos(d*x+c)**2*(a+I*a*tan(d*x+c))**3,x)

[Out]

I*a**3*log(exp(2*I*d*x) + exp(-2*I*c))/d + Piecewise((-I*a**3*exp(2*I*c)*exp(2*I*d*x)/d, Ne(d, 0)), (2*a**3*x*
exp(2*I*c), True))

________________________________________________________________________________________

Giac [A]
time = 0.64, size = 36, normalized size = 0.73 \begin {gather*} \frac {-i \, a^{3} e^{\left (2 i \, d x + 2 i \, c\right )} + i \, a^{3} \log \left (e^{\left (2 i \, d x + 2 i \, c\right )} + 1\right )}{d} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(cos(d*x+c)^2*(a+I*a*tan(d*x+c))^3,x, algorithm="giac")

[Out]

(-I*a^3*e^(2*I*d*x + 2*I*c) + I*a^3*log(e^(2*I*d*x + 2*I*c) + 1))/d

________________________________________________________________________________________

Mupad [B]
time = 3.29, size = 39, normalized size = 0.80 \begin {gather*} \frac {2\,a^3}{d\,\left (\mathrm {tan}\left (c+d\,x\right )+1{}\mathrm {i}\right )}-\frac {a^3\,\ln \left (\mathrm {tan}\left (c+d\,x\right )+1{}\mathrm {i}\right )\,1{}\mathrm {i}}{d} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

int(cos(c + d*x)^2*(a + a*tan(c + d*x)*1i)^3,x)

[Out]

(2*a^3)/(d*(tan(c + d*x) + 1i)) - (a^3*log(tan(c + d*x) + 1i)*1i)/d

________________________________________________________________________________________